<?php

/**
 * Contains a function to replace BR tags with \n.
 *
 * PHP Version 5
 *
 * @category BuyLocal
 * @package  BuyLocal
 * @author   Kevin Fodness <kevin.fodness@gmail.com>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://code.google.com/p/buylocalopensourcerensselaer/
 */

/**
 * A function to replace BR tags with \n.
 *
 * @param string $source The string to execute the replacement on.
 *
 * @access public
 * @return string        The modified string.
 */
function br2nl($source)
{
    /**
     * Explanation of regular expression:
     *
     * Matches a BR tag with any amount of space after the 'br' (\s*),
     * with 0 or 1 forward slashes (\/?)
     * and any amount of space between the slash and the > (\s*).
     */
    return preg_replace('/<br\s*\/?\s*>/', "\n", $source);
}

?>